using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UFrame;
using UFrame.Rendering;
using UFrame.ResContext;

public class GrayAgent : AgentContext<GrayAgent>
{
    protected Material m_grayMaterial;

    protected override void OnCreate()
    {
        base.OnCreate();
        m_grayMaterial = Resources.Load<Material>("gray_mat");
    }

    public void SetGray(UnityEngine.UI.Graphic graphic, bool gray)
    {
        if (!graphic)
            return;

        if (gray)
        {
            graphic.material = m_grayMaterial;
        }
        else
        {
            graphic.material = null;
        }
    }
}
